# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-07-21
# @File : 0_hook_header.py


import frida
import sys

rdev = frida.get_remote_device()
pid = rdev.spawn("cn.soulapp.android")
session = rdev.attach(pid)

scr = """
function hook_RegisterNatives() {
    Java.perform(function () {
        var f = Java.use("an.f");
        f.b.implementation = function (aVar,rVar) {
            console.log("---------------------")
            console.log("这是参数aVar:",aVar);
            console.log("这是参数rVar:",rVar);
            console.log("这是参数di:",aVar.a("di", q.f135641e));
            var res = this.b(aVar,rVar);
            console.log(res);
        };
    });
}

setImmediate(hook_RegisterNatives);
"""
script = session.create_script(scr)


def on_message(message, data):
    print(message, data)


script.on("message", on_message)

script.load()
rdev.resume(pid)
sys.stdin.read()
